//create by lwy 2017年12月6日16:20:01

var companyCode = GetQueryString('companyCode');
if(companyCode==""||companyCode==null||companyCode==undefined){
    if(getItem('companyCode')==null||getItem('companyCode')==undefined||getItem('companyCode')==""){
        companyCode = ""
    }else{
        companyCode = getItem('companyCode');
    }
}else{
    companyCode = GetQueryString('companyCode');
}

if(ifApp()==0){
    if(ifNewUser()){}else{
        removeItem('token');
        removeItem('userId');
    }
    removeItem('companyCode')
    setItem('companyCode',companyCode);
}else{
    if(ifApp()==1){
        //ios
        setupWebViewJavascriptBridge(function(bridge) {
            bridge.callHandler('getCompanyCode',function(responseData) {
                ifIos = 1;
                companyCode = responseData;
                setItem('companyCode',companyCode);
            })
        })
    }else if(ifApp()==2){
        //android
        //setItem('companyCode',companyCode);
    }else{
        setItem('companyCode',companyCode);
    }
}


//给安卓用
function getCode(code) {
    ifandroid = 1;
    companyCode = code;
    setItem('companyCode',companyCode);
}

//判断是否进入新的公众号/app
function ifNewUser() {
    if(companyCode==getItem('companyCode')){
        return true;
    }else{
        return false;
        //removeItem('token');
    }
}
